package com.kingsoft.demo.listener;

import java.util.Enumeration;
import java.util.Vector;

/**
 * 事件源对象
 * 
 * @author kbl
 *
 */
public class DemoSource {
	
  
	private Vector repository = new Vector();//监听自己的监听器队列
    public DemoSource(){
    	
    }
    
    public void addDemoListener(DemoListener dl) { //添加监听器
           repository.addElement(dl);
    }
    
    public void notifyDemoEvent() {//通知所有的监听器
           Enumeration enu = repository.elements();
           while(enu.hasMoreElements()) {
        	   DemoListener dl = (DemoListener)enu.nextElement();
               dl.handleEvent(new DemoEvent(this));
           }
    }
}